﻿{include file="public/header" /}
<title></title>
<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
</head>

<body>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统管理 <span class="c-gray en">&gt;</span> 商家管理
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<form class="form form-horizontal" id="form-admin-add" method="post" style="width: 45%;">
		<div class="row cl">
			<label class="form-label col-xs-4"><span class="c-red">*</span>商户账号：</label>
			<div class="formControls col-xs-8 ">
				<input id="mobile" name="mobile" type="text" class="input-text" placeholder="请输入商家登录账号" >
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4"><span class="c-red">*</span>商户手机号码：</label>
			<div class="formControls col-xs-8 ">
				<input id="tel" name="tel" type="text" class="input-text" placeholder="请输入商家手机号码" >
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4"><span class="c-red">*</span>签约状态：</label>
			<div class="formControls col-xs-8 ">
				<select name="is_state" style="width: 210px;height: 25px;">
					<option value="0">全部</option>
					<option value="1">已签约</option>
					<option value="2">未签约</option>
				</select>
			</div>
			<button type="submit" style="float: right;margin-top: 10px;width: 270px;height: 25px;">搜索</button>
		</div>
	</form>
	<div class="page-container">
		<table class="table table-border table-bordered table-bg">
			<thead>
				<tr class="text-c">
					<th width="10">ID</th>
					<th width="50">商家名</th>
					<th width="50">帐号</th>
					<th width="50">市代</th>
					<th width="50">省代</th>			
					<th width="50">余额</th>
					<th width="50">累计提现</th>
					<th width="50">提现次数</th>
					<th width="50">累计收入</th>
					<th width="50">鼓励金</th>
					<th width="50">签约</th>
					<th width="50">状态</th>	
					<th width="50">增加时间</th>
					<th width="130">银行</th>
				</tr>
			</thead>
			<tbody>
				{volist name="list" id="vo" empty="这里没有数据"}
				<tr class="text-c">
					<td>{$vo.id}</td>
					<td><a class="iconfont icon-erweima"  href="javascript:;" onclick="fukuan('{$vo.id}')"></a>{$vo.agent_name}</td>
					<td>{$vo.mobile}</td>
					<td>{$vo.pname}</td>
					<td>{$vo.cname}</td>				
					<td><a href="{:url('accounts/agentye',['agent_id'=>$vo.id])}">{$vo['balance']}</a></td>
					<td>{$vo.total_withdrawals_money}</td>
					<td>{$vo.total_withdrawals_num}</td>
					<td>{$vo.total_income}</td>
					<td><a href="{:url('accounts/agentglj',['agent_id'=>$vo.id])}">{$vo['score']}</a></td>
					<td>
						{if $vo.is_state==1}
						已签约
						{else /}
						未签约
						{/if}
					</td>
					<td>
						{if $vo.status==1}
						正常
						{else /}
						冻结
						{/if}
					</td>
					<td>{$vo.add_time}</td>
					<!--<td class="td-manage">
					<a title="" href="javascript:;" onclick="agent_gf('官方签约','{:url('accounts/agent_gf',['id'=>$vo.id])}','400','400')" class="ml-5">官方签约</a>
				</td>-->
					<td class="td-manage">
						<a title="查看资料" href="{:url('sys/agent_examine',['id'=>$vo.id])}"  class="ml-5" style="text-decoration:none">查看资料</a>
						<a title="冻结" href="javascript:;" onclick="complain_del(this,{$vo.id},{$vo.status})" class="ml-5" style="text-decoration:none">
						{if $vo.status==1}
						<span style="color: red;">冻结</span>
						{else /}
						<span style="color: green;">激活</span>
						{/if}
						</a>					
						<!--<a title="" href="javascript:;" onclick="agent_nh('银行签约','{:url('accounts/agent_nh',['id'=>$vo.id])}','400','600')" class="ml-5">银行签约</a>-->
					</td>
				</tr>
				{/volist}
			</tbody>
		</table>
		<style>
			.pagination li {
				float: left;
			}
		</style>
		<div id="pageNav" class="pageNav">{$list->render()}</div>
	</div>
	{include file="public/footer" /}
	<script type="text/javascript">
		/*官方签约*/
		function agent_gf(title, url, w, h) {
			layer_show(title, url, w, h);
		}
		/*银行签约*/
		function agent_nh(title, url, w, h) {
			layer_show(title, url, w, h);
		}
		function fukuan(agent_id) {
				var url = 'fukuan?agent_id='+agent_id;
				layer.open({
				  type: 2,
				  title: '门店收款二维码',
				  shadeClose: true,
				  shade: 0.8,
				  area: ['426px', '658px'],
				  content: [url]
				}); 
			}
		/*商家-冻结*/
		function complain_del(obj, id, status) {
			var tiele = '';
			if(status==1){
				tiele = '确认要冻结吗？';
			}else{
				tiele = '确认要激活吗？';
			}
			layer.confirm(tiele, {
				btn: ['确定', '取消'] //按钮
			}, function() {
				$.ajax({
					type: 'get',
					url: "{:url('accounts/agent_frozen')}",
					dataType: 'json',
					data: {
						id: id,
						status: status
					},
					success: function(data) {
						if(data.code == 200) {
							layer.msg(data.msg, {
							  icon: 1,
							  time: 1000 //2秒关闭（如果不配置，默认是3秒）
							}, function(){
								location.href = "{:url('accounts/agent_list')}";
							});
						} else {
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							});
						}
					},
					error: function(data) {
						console.log(data.msg);
					}
				});
			});
		}
	</script>